package mr.ali.videoapp.portal.controller;


import com.github.pagehelper.PageInfo;
import mr.ali.videoapp.portal.model.CollectionWatch;
import mr.ali.videoapp.portal.service.ICollectionWatchService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Mr-ali
 * @since 2025-06-01
 */
@RestController
@RequestMapping("/portal/collectionWatch")
public class CollectionWatchController {

    @Resource
    private ICollectionWatchService collectionWatchService;

    @GetMapping("/all")
    public PageInfo<CollectionWatch> findAll(Integer pageNum, Integer pageSize, Integer userId) {
        return collectionWatchService.findAll(pageNum, pageSize, userId);
    }

    @GetMapping("/select")
    public PageInfo<CollectionWatch> findAllIndex(Integer pageNum, Integer pageSize, Integer userId) {
        return collectionWatchService.findAllIndex(pageNum, pageSize, userId);
    }

    @GetMapping("/delete")
    public Integer delete(Integer userId, Integer videoId) {
        return collectionWatchService.delete(userId, videoId);
    }

    @GetMapping("/update")
    public void update(Integer userId, Integer videoId) {
        collectionWatchService.update(userId, videoId);
    }
}
